#ifndef CIVIEW_FEEDBACKROTATION_H
#define CIVIEW_FEEDBACKROTATION_H

#include "../Core/Matrix.h"
#include "../Geometries/Geometry.h"
#include "Camera.h"
#include "Scene.h"

namespace CIView {
    class FeedbackRotation {
    /**
     * This class includes all data needed to draw the feedback to 
     * rotate the primitives selected   
     **/

    public:
        FeedbackRotation();              //Constructor
        virtual ~FeedbackRotation();     //Destructor

        
        static const float CIRCLE_RADIUS;

        //Used as names for the axes in the OpenGL names stack
        enum {
            X_AXIS
          , Y_AXIS
          , Z_AXIS
          , ALL_AXES
        };

    protected:        
        bool x, y, z;                               //Booleans to indicate which axes are selected
        CICore::Point position;                     //The position of the feedback

        float angle;                                //The current rotation angle
 
        bool renderizable;                          //A boolean to indicate if the feedback can be rendered        

        void DrawX_Axis();                          //Method called to draw a the x-axis feedback rotation
        void DrawY_Axis();                          //Method called to draw a the y-axis feedback rotation
        void DrawZ_Axis();                          //Method called to draw a the z-axis feedback rotation

        void DrawFeedback (Camera& camera);         //Method called to draw a feedback while an axis is selected

        void DrawFeedbackCircle();                  //Method called to draw the feedback circle
        void DrawCircle();                          //Method called to draw a circle representing an axis

        void DefineClippingPlane (Camera& camera);  //Method called to define a temporary clipping plane (used to cut the needless part of the circles axes)

    public:     
        //Utility Methods
        void ComputeFeedbackPosition (Scene& scene);    //Method called to compute the feedback position

        //Methods to select/deselect the axes of the feedback
        void SelectX();
        void SelectY();
        void SelectZ();
        void SelectAll();
        void DeselectAll();

        bool IsSelectedX();
        bool IsSelectedY();
        bool IsSelectedZ();

        void Render (Camera& camera);                   //Method called to draw the rotation feedback
        void LoadAxesNames (Camera& camera);            //Method called to load the names for the axes in the OpenGL names stack       

        void SetRotationAngle (float radians);          //Method called to set the rotation angle, so it can show the feedback while rotating

        CICore::Point& GetPosition();                   //Method called to get the feedback position
    };
}

#endif /* CIVIEW_FEEDBACKROTATION_H */
